package per.lonffy.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import per.lonffy.bean.MyProperties;
import per.lonffy.utils.SpringUtil;

/**
 * RestController 相当于同时加上了@Controller和@ResponseBody
 */
@RestController
public class HelloWorldController {
    @RequestMapping("/")
    public String hello() {
        return "Hello World这是";
    }

    @RequestMapping("/name")
    public String getName(){
        return "my name is luolongfei";
    }

    /**
     * 访问getDog 和 hiDog 都一样可以进来
     * @return 返回dog的信息
     */
    @RequestMapping(value={"getDog","hiDog"},method = RequestMethod.GET)
    public String returnDog() {
        return "I am a dog,My nam is mile";
    }

    @RequestMapping(value = {"authorInfo"},method = RequestMethod.GET)
    public MyProperties getAuthorInfo(){
       return (MyProperties) SpringUtil.getBean("authoInfo");
    }

}
